<?php
/**
 *@author Connor <caokang@foxmail.com>
 *@todo
 *@link www.zeevin.com
 */
?>
<div class="title">
	<h3>照片管理</h3>
	<ul>
		<li class="current"><?php echo CHtml::link('照片管理', array('pic/index'));?></li>
		<li><?php echo CHtml::link('日志管理', array('post/index'));?></li>
	</ul>
</div>
<div class="main_content">
	<div class="photos">
		<div style="padding-left:18px;">
			<div class="add_photos">
				<?php echo CHtml::link('<span>添加图片</span>', array('pic/upload'))?>
			</div>
		</div>  
		<div class="photo_box">
			<ul>
				<?php if($data['total_num']>0):?>
				<?php foreach ($data['rows'] as $k => $v):?>
				<li>
					<?php echo CHtml::link(CHtml::image(Utils::getPAth($v->ctime,$v->hash_name),$v->title,array('width'=>115,'height'=>115)),'javascript:void(0);',array('title'=>$v->title))?>
					<p class="photo_info"><span><span><?php echo CHtml::encode($v->title);?></span></span></p>
					<p class="photo_btn"><span  style="display:none" class="modify_photo_info">修改说明</span><span tag="<?php echo $v->id?>"  class="delete_photo_info">删除</span></p>
				</li>
				<?php endforeach;?>
				<?php else:?>
				<li>
					<a href="#" title="测试相册"><img src="images/photos.jpg" width="115" height="115" alt="测试相册"/></a>
					<p class="photo_info"><span>这是我的办公桌测试</span></p>
					<p class="photo_btn"><span style="display:none" class="modify_photo_info">修改说明</span><span class="delete_photo_info">删除</span></p>
				</li>
				<?php endif;?>
			</ul>
		</div>
		<div class="page">
			<?php $this->widget('ZLinkPager', array('pages' => $data['pages'])); ?>
		</div>
	</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
	$('.delete_photo_info').click(function(){
		if(confirm('确认删除？')){
			$.post('?r=pic/del',{id:$(this).attr('tag')},
				function(data){
					data = $.parseJSON(data);
					if(data.status=='0')location.reload();
					else alert(data.desc);
				});
		}
	})
})
</script>